<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<form class="dggui-form" action="" id="abnormalForm" style="width: 92%;">
    <input type="hidden" name="idStr" value="${ids}">
    <%--<div class="dggui-form-item" style="margin-top: 15px;">
        <label class="dggui-form-label"><span style="color: #f8813f;margin-right: 2px;">*</span>部门选择:</label>
        <div class="dggui-input-block">
            <select id="deptId" name="deptId"  class="dggui-select" style="display: block" onchange="dept();">
                <option value="-1">请选择部门</option>
                <c:forEach items="${orgs}" var="o">
                    <option value="${o.id}">${o.name}</option>
                </c:forEach>
            </select>
        </div>
    </div>--%>
    <div class="dggui-form-item" style="margin-top: 15px;">
        <label class="dggui-form-label"><span style="color: #f8813f;margin-right: 2px;">*</span>负责人:</label>
        <div class="dggui-input-block">
            <select name="assistId" id="headPerson" class="dggui-select" style="display: block">
                <option value="-1">请选择负责人</option>
            </select>
        </div>
    </div>
    <div class="dggui-form-item dggui-form-text">
        <label class="dggui-form-label"><span style="color: #f8813f;margin-right: 2px;">*</span>备注:</label>
        <div class="dggui-input-block">
            <textarea name="remark" id="remarkInfo" placeholder="请填写备注,1-500字" class="dggui-textarea" maxlength="500" ></textarea>
        </div>
    </div>

</form>
<script>
    dggui.use(['select2'], function (){
        var select2 = dggui.select2;
        //初始化流程人员
        initUser("RZSC_FLOW_USER","division","#headPerson");
        select2.render({
            placeholder: "请选择",
            allowClear: true,
            elem: $('#headPerson'),
            width: "190px"
        });

    });
    function sureTurnover(table,index){
        var headPerson = $("#headPerson").val();
        var remarkInfo = $("#remarkInfo").val().trim();

        if (!(verifyEmpty($("#headPerson"), '请选择负责人原因') &&verifyRemark($("#remarkInfo"), 1, 500, "请填写1-500字的备注信息"))) {
            return;
        } else {
            var params = $('#abnormalForm').serializeArray();
            dggui.dialog.loading();
            $.ajax({
                type: 'POST',
                async: true,
                data: params,
                url: sysInfo.basePath + '/all_order/save_turn_over.do',
                dataType: 'JSON',
                success: function (data) {
                    console.log(data);
                    dggui.dialog.loading('close');
                    if (data.code == 0) {
                        dggui.dialog.succeed('操作成功！')
                        if (null != index && undefined !=index) {
                            layer.close(index);
                        }
                        //刷新列表
                        reloadTable(table,"reloadFalse");
                    } else {
                        dggui.dialog.errors("操作失败："+data.msg);
                    }
                },
                error: function () {
                    dggui.dialog.loading('close');
                    dggui.dialog.errors('操作失败，请联系管理员！');
                }
            })
        }


    }
</script>
